<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="org.apache.shiro.web.filter.authc.FormAuthenticationFilter"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html style="height:100%">
<head>
	<title>${fns:getConfig('productName')} 登录</title>
	<meta name="decorator" content="blank"/>
	<meta charset="UTF-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
	<script type="text/javascript" src="${ctxStatic }/layer/layer.js"></script>
	<link href="${ctxStatic}/layui/css/loginFont.css" rel="stylesheet" type="text/css">
	<link href="${ctxStatic}/layui/css/loginLayui.css" rel="stylesheet" type="text/css">
	<script type="text/javascript">
		$(document).ready(function() {
			layui.use(['laypage', 'form','table'], function(){
	              var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
	              form.render();
			});
			var errMsg = '${message}';
			if(errMsg){
				layer.alert(errMsg);
			}
			$("#loginForm").validate({
				rules: {
					validateCode: {remote: "${pageContext.request.contextPath}/servlet/validateCodeServlet"}
				},
				messages: {
					validateCode: {remote: "验证码不正确."}
				}
			});
		});
		// 如果在框架或在对话框中，则弹出提示并跳转到首页
		if(self.frameElement && self.frameElement.tagName == "IFRAME" || $('#left').length > 0 || $('.jbox').length > 0){
			alert('未登录或登录超时。请重新登录，谢谢！');
			top.location = "${ctx}";
		}
	</script>
</head>
<body class="login-bg">
    <div class="login">
        <div class="message">欢迎使用${fns:getConfig('productName')}</div>
        <div id="darkbannerwrap"></div>
        
        <form method="post" class="layui-form" action="${ctx}/login" method="post">
            <input name="username" placeholder="用户名"  type="text" lay-verify="required" class="layui-input" value="${username}" >
            <hr class="hr15">
            <input name="password" lay-verify="required" placeholder="密码"  type="password" class="layui-input">
            <hr class="hr15">
            <c:if test="${isValidateCodeLogin}">
				<div class="validateCode">
					<label class="validateLable" for="validateCode">验证码</label>
					<sys:validateCode name="validateCode" inputCssStyle="width:100px;" btnCssClass="layui-blue"
					otherAttr='lay-verify="required"' />
				</div>
				<hr class="hr15">
			</c:if>
            <input class="loginin" value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
            <hr class="hr20" >
        </form>
    </div>
</body>
</html>
